<?php

use Illuminate\Http\Request;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/

/*Route::middleware('auth:api')->get('/user/info', function (Request $request) {
    return $request->user();
});*/

Route::get('/ceshi',function(\App\Repository\WorkShopRepository $repository){
//$messenger=EasyWeChat::work('test')->messenger;
      $repository::setSlider(\App\model\Workshop::first());
  /*$workshop=\App\model\Workshop::first();
    $workflow = Workflow::get($workshop, 'straight');
    var_dump($workflow->can($workshop, '业务提交'));
    $transitions = $workflow->getEnabledTransitions($workshop);
    dd($transitions);
    dd($workflow->getMarkingStore());
    var_dump($transitions);
    $workflow->apply($workshop, 'first_sure');
    $transitions = $workflow->getEnabledTransitions($workshop);
    var_dump($transitions);*/

// 发送
 //  return  $messenger->message('aaaa')->ofAgent('1000010')->toUser(\App\User::find(650)->userid)->send();
//dd($app->department->list());
/* $app= new \App\Service\MiniWorkService();
return $app->send(\App\User::find(650),'有一条盘源发布待审核','pages/index/index',[
    [
        'key'=>'申请人',
        'value'=>'徐鹏飞',
    ],
]);*/
});

Route::post('user/login', 'AuthController@login')->name('login');
Route::post('user/loginMini', 'AuthController@loginMini');
Route::post('user/logout', 'AuthController@logout');
Route::post('user/refresh', 'AuthController@refresh');
Route::get('DisSource/top','DiskSourceController@top');//置顶的盘源
Route::get('DisSource/newList','DiskSourceController@newList');//最新的盘源
Route::middleware('auth:api')->group(function (){
    Route::get('me', 'AuthController@me');
    Route::post('DiskSource/created','DiskSourceController@create');//创建盘源
    Route::post('DiskSource/edit/{id}','DiskSourceController@edit');//更新盘源

    Route::post('DisSource/shenhe/{id}','DiskSourceController@shenhe'); //审核通过
    Route::post('DisSource/refuse/{id}','DiskSourceController@refuse');//拒绝
    Route::get('DisSource/publishList','DiskSourceController@publishList');//发布的详情
    Route::get('DisSource/shenhe/{id}','DiskSourceController@shenheDetail');//查看审批详情


    Route::get('DisSource/edit/{id}','DiskSourceController@isEdit');//查看是否更新
    Route::get('user/index','UserController@index');    //个人首页
    Route::post('DisSource/collect/{id}','DiskSourceController@collect');//收藏 取消房源
    Route::get('DisSource/collect/{id}','DiskSourceController@isCollect');//是否收藏
    Route::get('DisSource/collect','DiskSourceController@collectPanyuan');//收藏房源
    Route::post('DisSource/apply/{id}','DiskSourceController@apply');//申请查看业主
    Route::post('DisSource/cancel/{code}','DiskSourceController@cancel');//取消查看
    Route::post('DisSource/can/view','DiskSourceController@canView'); //是否能查看业主                                                                               //是否能查看业主
    Route::get('DisSource/detail/{id}','DiskSourceController@detail');//盘源详情
    Route::get('DisSource/shenpi','DiskSourceController@shenpi');//审批列表                                                                                //消息审核列表 管理员
    Route::get('Gonggao/list','GonggaoController@index');//公告列表
    Route::get('Gonggao/detail/{id}','GonggaoController@detail');//公告详情
    Route::get('DisSource/workshop/{id}','DiskSourceController@workshop');//发布页面编辑详情
    Route::get('User/rank','UserController@rank');
    Route::get('User/userNotify','UserController@userNotify');    //我的消息
    Route::get('User/agent','UserController@agentUser');    //转发名片系统

    Route::get('DisSource/updateList/{id}','DiskSourceController@updateList');//更新详情
    Route::get('user/data','UserController@data');//更新详情
    Route::get('DisSource/overdue','DiskSourceController@overdue');//即将过期的盘源
    Route::post('DisSource/overdue/notice/{id}','DiskSourceController@notice');//提醒更新
    Route::get('user/applyList','UserController@applyList');
    Route::get('user/applyShenqing','UserController@applyShenqing');
    Route::get('DisSource/updatedList','DiskSourceController@updatedList');        //待更新房源

});

Route::post("/upload","UploadFileController@upload");//上传文件
Route::post("/upload/ueditor","UploadFileController@uploadUeditor");//上传文件
Route::get('/workshop_contact/{workshopId}','DiskSourceController@getContact');//获取园区联系人
Route::get('DisSource/type','DiskSourceController@type')->middleware('api.cache'); //获取类型
Route::get('DisSource/uploadToken','DiskSourceController@uploadToken'); //获取类型
Route::get('DisSource/city','DiskSourceController@city'); //地区区域


